#pragma once
//#include "stdafx.h"
#include "GridFactory.h"
namespace org
{
	namespace spark
	{
		namespace data
		{
			//using org::spark::core::ExecutionMode;
			using org::spark::core::Observer;
			using org::spark::space::BoundedSpace;
			//using org::spark::space::BoundedSpace3d;
			using org::spark::space::Space;

			org::spark::data::Grid *GridFactory::createGrid(int xSize, int ySize)
			{
				return createGrid(Observer::getDefaultSpace(), xSize, ySize);
			}

			/*Grid3d *GridFactory::createGrid(int xSize, int ySize, int zSize)
			{
				return createGrid(Observer::getDefaultSpace(), xSize, ySize, zSize);
			}*/

			org::spark::data::Grid *GridFactory::createGrid(Space *space, int xSize, int ySize)
			{
				if (!(dynamic_cast<BoundedSpace*>(space) != 0))
				{
					//throw Error("A 2d-grid cannot be created in the given space: " + space);
				}

				/*int mode = Observer::getInstance()->getExecutionMode();

				switch (mode)
				{
				case ExecutionMode::SERIAL_MODE:*/
					return new Grid(space, xSize, ySize);

				/*case ExecutionMode::CONCURRENT_MODE:
					return new Grid_concurrent(space, xSize, ySize);

				case ExecutionMode::PARALLEL_MODE:
					return new Grid_parallel(space, xSize, ySize);*/
				//}

// There is no native C++ equivalent to 'toString':
				//throw Error("Grid cannot be created in the current execution mode: " + ExecutionMode->toString(mode));
			}

			/*Grid3d *GridFactory::createGrid(Space *space, int xSize, int ySize, int zSize)
			{
				if (!(dynamic_cast<BoundedSpace3d*>(space) != 0))
				{
					//throw Error("A 3d-grid cannot be created in the given space: " + space);
				}

				int mode = Observer::getInstance()->getExecutionMode();

				switch (mode)
				{
				case ExecutionMode::SERIAL_MODE:
					return new Grid3d(space, xSize, ySize, zSize);

						//		case ExecutionMode.CONCURRENT_MODE:
						//			return new Grid3d_concurrent(space, xSize, ySize);

						//		case ExecutionMode.PARALLEL_MODE:
						//			return new Grid3d_parallel(space, xSize, ySize);
				}*/

// There is no native C++ equivalent to 'toString':
				//throw Error("Grid cannot be created in the current execution mode: " + ExecutionMode->toString(mode));
			//}
		}
	}
}
